<%@ page contentType="text/html;charset=UTF-8" %>

<script type="text/javascript">
    window.parent.stopRead = false;
    $(function(){
        var countHtml = "<div class='col-md-2'>" +
                            "<div onclick='quitSystem()' class='countdown_btn'>" +
                                "<div class='countdown_tip'>退出</div>" +
                                "<div id='countdown_content' class='countdown'></div>" +
                            "</div>" +
                        "</div>";
        $(".page-header").find(".row").append(countHtml);

        setInterval(finalCountdown, 1000);
    });

    var THIS_FINAL_COUNT = (FINAL_COUNT === 0 || FINAL_COUNT === '') ? 20 : FINAL_COUNT;
    var finalCount = THIS_FINAL_COUNT;
    function resetCount(){
        finalCount = THIS_FINAL_COUNT;
    }
    function finalCountdown() {
        $("#countdown_content").html(finalCount);
        if(finalCount === 0){
            quitSystem();
        }
        finalCount--;
    }
    function quitSystem() {
        try{
            //window.parent.doReaderClose();
            window.parent.stopRead = true;
        }catch(e){}
        top.location.href = "${cts}/";
    }
</script>
